﻿<%@ Page Title="" Language="C#" MasterPageFile="~/FormView/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="Contact.aspx.cs" Inherits="Team4Mock.FormView.Contact" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        function basicPopup() {
            popupWindow = window.open("/FormView/PopupContact.aspx", 'popUpWindow', 'height=500,width=800,left=300,top=100,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
        }
        function Return() {
            var Str = document.getElementsByName('select').length;
            for (var i = 0; i < document.getElementsByName('select').length; i++) {
                var a = document.getElementsByName('select').item(i).checked;
                if (a == true) {
                    var s = document.getElementsByName('select').item(i).value;
                    var kq = s.split("-");
                    window.opener.document.getElementById('Name').value = kq[0];
                    window.opener.document.getElementById('id').value = kq[1];
                    window.close();
                }
            }
        }
        function confirmbtn() {
            var s = document.getElementById('id').value;
            if (s != "") {
                document.getElementById('<%=idContact.ClientID%>').value = s;
            }
            else return false;
        }
        function create() {
            var s = document.getElementById('id').value;
            if (s != "") {
                document.getElementById('<%=IDNew.ClientID%>').value = s;
            }
            else return false;
        }
        function Close() {
            window.close();
        }
    </script>
    <style type="text/css">
        #Name
        {
            width: 116px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel ID="pnList" runat="server">
        <div style="width: 750px; margin-left: 10px;">
            <h3>
                Search Contact</h3>
            <hr />
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="style1" width="140px">
                        First Name
                    </td>
                    <td class="style3" width="160px">
                        <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
                    </td>
                    <td class="style2" width="140px">
                        Surname
                    </td>
                    <td>
                        <asp:TextBox ID="txtSurname" runat="server" Width="160px"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <br />
            <asp:Button ID="btnSearch" runat="server" Style="width: 120px;" CssClass="button"
                Text="Search Contact" OnClick="btnSearch_Click" />
            <asp:Button ID="btnClear" runat="server" CssClass="button" Text="Clear" OnClick="btnClear_Click" />
            <asp:Button ID="btnCreate" runat="server" CssClass="button" Text="Create" OnClick="btnCreate_Click" /><br />
            <asp:CheckBox ID="ckActive" runat="server" AutoPostBack="true" Text="Include In-active contact?"
                OnCheckedChanged="ckActive_CheckedChanged" /><br />
            <asp:UpdatePanel ID="pnanel" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="gvContact" AutoGenerateColumns="false" DataKeyNames="ContactID"
                        runat="server" Width="709px" Font-Size="15px" BackColor="White" BorderColor="#CCCCCC"
                        AllowSorting="true" OnSorting="gvContact_Sorting" BorderStyle="None" BorderWidth="1px"
                        CellPadding="3">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <input type="radio" id="select" name="select" value='<%#Eval("ContactID") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="ID" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="lbID" runat="server" Text='<%#Eval("ContactID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Contact Name" SortExpression="Contact Name">
                                <ItemTemplate>
                                    <asp:HyperLink ID="OrgName" runat="server" Text='<%#Eval("Contact Name") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Mobile Phone">
                                <ItemTemplate>
                                    <asp:Label ID="lbHOA" runat="server" Text='<%#Eval("MobilePhone") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Email" SortExpression="Email">
                                <ItemTemplate>
                                    <asp:Label ID="lbPostcode" runat="server" Text='<%#Eval("Email") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Contact Type" SortExpression="ContactTypeName">
                                <ItemTemplate>
                                    <asp:Label ID="lbContact" runat="server" Text='<%#Eval("ContactTypeName") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Is Active" SortExpression="IsActive">
                                <ItemTemplate>
                                    <asp:Label ID="lbActive" runat="server" Text='<%#Eval("IsActive") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="White" ForeColor="#000066" />
                        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                        <RowStyle ForeColor="#000066" />
                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                    </asp:GridView>
                </ContentTemplate>
                <Triggers>
                    <%--<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnCreate" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnEdit" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnClear" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnBack" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />--%>
                    <asp:AsyncPostBackTrigger ControlID="ckActive" EventName="CheckedChanged" />
                    <asp:AsyncPostBackTrigger ControlID="gvContact" EventName="Sorting" />
                </Triggers>
            </asp:UpdatePanel>
            <asp:UpdateProgress ID="pro" runat="server" AssociatedUpdatePanelID="pnanel">
            </asp:UpdateProgress>
            <asp:Label ID="tb" runat="server"></asp:Label>
            <br />
            <asp:Button ID="btnSelect" runat="server" CssClass="button" Text="Select" OnClientClick="Return()" />
            <asp:Button ID="btnEdit" runat="server" CssClass="button" Text="Edit" OnClick="btnEdit_Click" />
            <asp:Button ID="btnClose" runat="server" CssClass="button" Text="Close" OnClientClick="Close()" />
            <br />
        </div>
    </asp:Panel>
    <asp:Panel ID="pnAdd" runat="server">
        <fieldset style="width: 760px; margin-left: 10px;">
            <legend style="height: 25px; background-color: #465c71; -webkit-border-radius: 5px 5px 0px 0px;
                color: #dde4ec; font-size: 18px;">Contact Details</legend>
            <h2>
                Amend Contact</h2>
            <table width="765px" cellpadding="0px" cellspacing="0px" border="0" style="font-size: 15px;">
                <tr>
                    <td class="style3">
                        First Name <span style="color: Red;">(*)</span>
                    </td>
                    <td class="style3">
                        <asp:TextBox ID="txtFName" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style3">
                        Manager Name
                    </td>
                    <td class="style3">
                        <input type="text" id="Name" readonly="readonly" />
                        <input type="hidden" id="id" />
                        &nbsp;&nbsp;<a href="#" onclick="basicPopup();return false;">Lookup</a>
                        <asp:CheckBox ID="None" runat="server" Text="None" />
                        <asp:HiddenField ID="NameContact" runat="server" />
                        <asp:HiddenField ID="idContact" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Surname<span style="color: Red;">(*)</span>
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="txtSName" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style4">
                        Contact Type &nbsp; <span style="color: Red;">(*)</span>
                    </td>
                    <td class="style4">
                        <asp:DropDownList ID="dlContactType" runat="server" Width="180px" AutoPostBack="true"
                            DataTextField="ContactTypeName" DataValueField="ContactTypeID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        Knows As
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtKnowsAs" Width="186px" runat="server"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Best Contact Method
                    </td>
                    <td class="style5">
                        <asp:DropDownList ID="dlBestContactMethod" runat="server" Width="180px" AutoPostBack="true"
                            DataTextField="ContactBestMethodName" DataValueField="ContactBestMethodID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        Office Phone
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtOffPhone" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Job Role
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtJobRole" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Mobile Phone
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="txtMobPhone" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style4">
                        Workbase
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="txtWorkbase" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        ST Home Phone
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtHomePhone" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Job Title
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtJobTitle" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Email Address
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="txtEmail" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td>
                        Is Active
                    </td>
                    <td>
                        <asp:CheckBox ID="CheckBox1" runat="server" />
                    </td>
                </tr>
            </table>
            <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button" OnClientClick="confirmbtn()"
                OnClick="btnSave_Click" />
            <asp:Button ID="btnBack" runat="server" Text="Back" CssClass="button" OnClick="btnBack_Click" /><br />
            <asp:Label ID="mess" runat="server"></asp:Label>
        </fieldset>
    </asp:Panel>
    <asp:Panel ID="pnAmend" runat="server">
        <fieldset style="width: 760px; margin-left: 10px;">
            <legend style="height: 25px; background-color: #465c71; -webkit-border-radius: 5px 5px 0px 0px;
                color: #dde4ec; font-size: 18px;">Contact Details</legend>
            <h2>
                Create Contact</h2>
            <table width="765px" cellpadding="0px" cellspacing="0px" border="0" style="font-size: 15px;">
                <tr>
                    <td class="style3">
                        First Name <span style="color: Red;">(*)</span>
                    </td>
                    <td class="style3">
                        <asp:TextBox ID="TextBox1" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style3">
                        Manager Name
                    </td>
                    <td class="style3">
                        <input type="text" id="Name" readonly="readonly" />
                        <input type="hidden" id="id" />
                        &nbsp;&nbsp;<a href="#" onclick="basicPopup();return false;">Lookup</a>
                        <asp:CheckBox ID="ckNone" runat="server" Text="None" />
                        <asp:HiddenField ID="IDNew" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Surname<span style="color: Red;">(*)</span>
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="TextBox2" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style4">
                        Contact Type &nbsp; <span style="color: Red;">(*)</span>
                    </td>
                    <td class="style4">
                        <asp:DropDownList ID="DropDownList1" runat="server" Width="180px" AutoPostBack="true"
                            DataTextField="ContactTypeName" DataValueField="ContactTypeID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        Knows As
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="TextBox3" Width="186px" runat="server"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Best Contact Method
                    </td>
                    <td class="style5">
                        <asp:DropDownList ID="DropDownList2" runat="server" Width="180px" AutoPostBack="true"
                            DataTextField="ContactBestMethodName" DataValueField="ContactBestMethodID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        Office Phone
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="TextBox4" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Job Role
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="TextBox5" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Mobile Phone
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="TextBox6" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style4">
                        Workbase
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="TextBox7" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style5">
                        ST Home Phone
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="TextBox8" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style5">
                        Job Title
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="TextBox9" runat="server" Width="186px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Email Address
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="TextBox10" runat="server" Width="186px"></asp:TextBox>
                    </td>
                    <td>
                        Is Active
                    </td>
                    <td>
                        <asp:CheckBox ID="CheckBox2" runat="server" />
                    </td>
                </tr>
            </table>
            <asp:Button ID="Button1" runat="server" Text="Save" CssClass="button" OnClientClick="create()"
                OnClick="Button1_Click" />
            <asp:Button ID="Button2" runat="server" Text="Back" CssClass="button" OnClick="btnBack_Click" /><br />
            <asp:Label ID="lb" runat="server" Style="font-style: italic;"></asp:Label>
        </fieldset>
        <%--<uc1:AddContact ID="addc" runat="server" />--%>
    </asp:Panel>
</asp:Content>
